simid=$1
date=`date +"%Y%m%d"`

samplecsv=`ls /data/POC/pgtweb/samplesheet/*/*-${simid}-GZ-MGISEQ.xlsx`
if [ ! -n "$samplecsv" ];then
  echo "文件bu存在"
  exit
else
  echo "文件已经存在"
fi
downdata=`ls /mnt/share/${simid}/L01/BarcodeStat.txt`
if [ ! -n "$downdata" ];then
  echo "文件bu存在"
  exit
else
  echo "文件已经存在"
fi

outdir=/data/cnv-seq/$simid/fastq
mkdir /data/cnv-seq/$simid
bindir=/home/runmngs/cnv-seq
mkdir $outdir
mkdir /data/cnv-seq/$simid/result

python3.8 $bindir/changename.py $samplecsv /mnt/share/${simid}/L01 $outdir
cd $outdir
sh run_rename.sh
cd /data/cnv-seq/$simid/result
for i in $outdir/*.gz;do echo "sh $bindir/PGS_pipeline.DNAcopy_100k.sh $bindir $i";done >run.sh
cat run.sh|xargs -I {} --max-procs=30 bash -c {}
grep -v "ID" *.CNV.seg >DNAcopy.seg

#rm *.bam *.bai
for i in *75mer_15k.counts;do mv ${i%%.75mer*}*  ${i%%.75mer*};done
rm run.sh
cd ..

zip -r ${simid}_result.zip result

python2 $bindir/eeemail.py $simid ${simid}_result.zip


